using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySoft.Data;
using System.Data;
using ShareMarking.Entity;

namespace ShareMarking.Service
{
    public class sfdc_PNRService : BaseDao<sfdc_PNR>
    {
        #region "单例"
        private static sfdc_PNRService service;
        public static sfdc_PNRService Instance
        {
            get
            {
                if (service == null)
                {
                    service = new sfdc_PNRService();
                }
                return service;
            }
        }
        #endregion

        #region 分页方法
        public DataTable Get_sfdc_PNR_PageSelect(int pageNo, int pageSize,
                     string sort, out int totalCount, String EmployeeNumber__c, String Region__c, String Area__c, String Name__c, String IsActive__c)
        {
            WhereClip whereClip = new WhereClip("");           
                if (!EmployeeNumber__c.IsNullOrEmpty())
                {
                    whereClip = whereClip && sfdc_PNR._.EmployeeNumber__c.Contains(EmployeeNumber__c);
                }
                if (!Region__c.IsNullOrEmpty())
                {
                    whereClip = whereClip && sfdc_PNR._.Region__c.Contains(Region__c);
                }
                if (!Area__c.IsNullOrEmpty())
                {
                    whereClip = whereClip && sfdc_PNR._.Area__c.Contains(Area__c);
                }
                if (!Name__c.IsNullOrEmpty())
                {
                    whereClip = whereClip && sfdc_PNR._.Name__c.Contains(Name__c);
                }
                if (!IsActive__c.IsNullOrEmpty())
                {
                    if (IsActive__c == "true")
                    {
                        whereClip = whereClip && sfdc_PNR._.IsActive__c == 1;
                    }
                    else
                    {
                        whereClip = whereClip && sfdc_PNR._.IsActive__c == 0;
                    }
                } 
            return Get_Entity_byPage_ToTable(pageNo, pageSize, whereClip, new OrderByClip(sort), out totalCount);


        }
        #endregion
    }

}

